App({
    siteInfo: require("siteinfo.js"),
    onLaunch: function() {
        var e = require("siteinfo.js");
        console.log(e), wx.setStorageSync("siteroot", e.siteroot);
    },
    onShow: function() {},
    onHide: function() {},
    onError: function(e) {},
    getuser_info: function(t) {
        var n = this;
        wx.login({
            success: function(e) {
                n.util.request({
                    url: "entry/wxapp/Openid",
                    cachetime: "0",
                    data: {
                        code: e.code
                    },
                    success: function(e) {
                        console.log(e), getApp().session_key = e.data.session_key, getApp().OpenId = e.data.openid, 
                        getApp().getSK = e.data.session_key, n.util.request({
                            url: "entry/wxapp/login",
                            cachetime: "0",
                            data: {
                                openid: e.data.openid,
                                img: "",
                                name: ""
                            },
                            success: function(e) {
                                console.log(e), getApp().getuniacid = e.data.uniacid, getApp().user_info = e.data, 
                                wx.setStorageSync("userInfo", e.data), t(e.data);
                            }
                        });
                    },
                    fail: function(e) {},
                    complete: function(e) {}
                });
            }
        });
    },
    getUserInfo: function(n) {
        var a = this;
        wx.login({
            success: function(e) {
                a.util.request({
                    url: "entry/wxapp/Openid",
                    cachetime: "0",
                    data: {
                        code: e.code
                    },
                    success: function(t) {
                        console.log(t), getApp().session_key = t.data.session_key, getApp().OpenId = t.data.openid, 
                        getApp().getSK = t.data.session_key, wx.getUserInfo({
                            withCredentials: !1,
                            success: function(e) {
                                a.util.request({
                                    url: "entry/wxapp/login",
                                    cachetime: "0",
                                    data: {
                                        openid: t.data.openid,
                                        img: e.userInfo.avatarUrl,
                                        name: e.userInfo.nickName
                                    },
                                    success: function(e) {
                                        console.log(e), getApp().getuniacid = e.data.uniacid, getApp().user_info = e.data, 
                                        wx.setStorageSync("userInfo", e.data), n(e.data);
                                    }
                                });
                            },
                            fail: function() {
                                wx.showModal({
                                    title: "提示",
                                    content: "您拒绝个人信息授权,无法正常使用此小程序,点击确定重新获取授权。",
                                    showCancel: !1,
                                    success: function(e) {
                                        e.confirm && wx.openSetting({
                                            success: function(e) {
                                                e.authSetting["scope.userInfo"] ? wx.getUserInfo({
                                                    success: function(e) {
                                                        a.util.request({
                                                            url: "entry/wxapp/login",
                                                            data: {
                                                                openid: t.data.openid,
                                                                img: e.userInfo.avatarUrl,
                                                                name: e.userInfo.nickName
                                                            },
                                                            dataType: "json",
                                                            success: function(e) {
                                                                getApp().getuniacid = e.data.uniacid, wx.setStorageSync("UserData", e.data), n(e.data);
                                                            }
                                                        });
                                                    }
                                                }) : a.util.request({
                                                    url: "entry/wxapp/login",
                                                    data: {
                                                        openid: t.data.openid,
                                                        img: "",
                                                        name: ""
                                                    },
                                                    dataType: "json",
                                                    success: function(e) {
                                                        getApp().getuniacid = e.data.uniacid, wx.setStorageSync("UserData", e.data), n(e.data);
                                                    }
                                                });
                                            },
                                            fail: function(e) {}
                                        });
                                    }
                                });
                            },
                            complete: function(e) {}
                        });
                    },
                    fail: function(e) {},
                    complete: function(e) {}
                });
            }
        });
    },
    ormatDate: function(e) {
        var t = new Date(1e3 * e);
        return t.getFullYear() + "-" + n(t.getMonth() + 1, 2) + "-" + n(t.getDate(), 2) + " " + n(t.getHours(), 2) + ":" + n(t.getMinutes(), 2) + ":" + n(t.getSeconds(), 2);
        function n(e, t) {
            for (var n = "" + e, a = n.length, o = "", i = t; i-- > a; ) o += "0";
            return o + n;
        }
    },
    week: function(e) {
        return [ "星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" ][new Date(Date.parse("2008-08-08".replace(/-/g, "/"))).getDay()];
    },
    contains: function(e, t) {
        for (var n = e.length; n--; ) if (e[n].src === t) return n;
        return !1;
    },
    today: function() {
        var e = new Date(), t = e.getFullYear(), n = e.getMonth() + 1, a = e.getDate();
        return 1 <= n && n <= 9 && (n = "0" + n), 0 <= a && a <= 9 && (a = "0" + a), t + "-" + n + "-" + a;
    },
    time: function(e) {
        return new Date(1e3 * parseInt(e)).toLocaleString().replace(/:\d{1,2}$/, " ");
    },
    today_time: function(e) {
        var t = new Date(), n = t.getMonth() + 1, a = t.getDate();
        1 <= n && n <= 9 && (n = "0" + n), 0 <= a && a <= 9 && (a = "0" + a);
        var o = t.getHours(), i = t.getMinutes(), r = t.getSeconds();
        return o <= 9 && (o = "0" + o), i <= 9 && (i = "0" + i), r <= 9 && (r = "0" + i), 
        t.getFullYear() + "-" + n + "-" + a + " " + o + ":" + i + ":" + r;
    },
    yestoday: function(e) {
        var t = new Date().getTime() - 864e5, n = new Date();
        n.setTime(t);
        var a = n.getFullYear(), o = n.getDate(), i = n.getMonth() + 1;
        return i < 10 && (i = "0" + i), a + "-" + i + "-" + o;
    },
    convertHtmlToText: function(e) {
        var t = "" + e;
        return t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = (t = t.replace(/<\/div>/gi, "\r\n")).replace(/<\/li>/gi, "\r\n")).replace(/<li>/gi, "  *  ")).replace(/<\/ul>/gi, "\r\n")).replace(/<br\s*[\/]?>/gi, "\r\n")).replace("↵", "\n")).replace(/<p.*?>/gi, "\r\n")).replace(/<a.*href="(.*?)".*>(.*?)<\/a>/gi, " $2 ($1)")).replace(/<script.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/script>/gi, "")).replace(/<style.*>[\w\W]{1,}(.*?)[\w\W]{1,}<\/style>/gi, "")).replace(/<(?:.|\s)*?>/g, "")).replace(/(?:(?:\r\n|\r|\n)\s*){2,}/gim, "\r\n\r\n")).replace(/ +(?= )/g, "")).replace(/ /gi, " ")).replace(/&/gi, "&")).replace(/"/gi, '"')).replace(/</gi, "<")).replace(/>/gi, ">");
    },
    downLoadImg: function(e) {
        wx.downloadFile({
            url: e,
            success: function(e) {
                e.tempFilePath;
            }
        });
    },
    util: require("we7/resource/js/util.js"),
    tabBar: {
        color: "#123",
        selectedColor: "#1ba9ba",
        borderStyle: "#1ba9ba",
        backgroundColor: "#fff",
        list: [ {
            pagePath: "/we7/pages/index/index",
            iconPath: "/we7/resource/icon/home.png",
            selectedIconPath: "/we7/resource/icon/homeselect.png",
            text: "首页"
        }, {
            pagePath: "/we7/pages/user/index/index",
            iconPath: "/we7/resource/icon/user.png",
            selectedIconPath: "/we7/resource/icon/userselect.png",
            text: "微擎我的"
        } ]
    },
    globalData: {
        userInfo: null
    }
});